from rest_framework import serializers
from .models import *
from rest_framework import generics


class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = "__all__"


class ModuleSerializer(serializers.ModelSerializer):
    class Meta:
        model = ModulesModel
        fields = "__all__"

    # def to_representation(self, instance):
    #     # 使用模型的__doc__属性作为模型的名称
    #     model_name = instance.__class__.__doc__.strip()
    #     representation = super().to_representation(instance)
    #     representation['model_name'] = '123456'
    #     return representation


class MenusModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = MenusModel
        fields = "__all__"


class GropSerializer(serializers.ModelSerializer):
    class Meta:
        model = GropModel
        fields = "__all__"


class PostSerializer(serializers.ModelSerializer):
    class Meta:
        model = PostModel
        fields = "__all__"


class InstitutionsSerializer(serializers.ModelSerializer):
    class Meta:
        model = InstitutionsModel
        fields = "__all__"


class ClassificationSerializer(serializers.ModelSerializer):
    class Meta:
        model = ClassificationModel
        fields = "__all__"


class InstitutionsTypesSerializer(serializers.ModelSerializer):
    class Meta:
        model = InstitutionsTypesModel
        fields = "__all__"


class InstitutionsSelectSerializer(serializers.ModelSerializer):
    class Meta:
        model = InstitutionsSelectModel
        fields = "__all__"


class MenusPermissionsSerializer(serializers.ModelSerializer):
    class Meta:
        model = MenusPermissionsModel
        fields = "__all__"


class UserGropModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = UserGropModel
        fields = "__all__"


class FlowSerializer(serializers.ModelSerializer):
    class Meta:
        model = FlowModel
        fields = "__all__"


class ImagesSerializer(serializers.ModelSerializer):
    class Meta:
        model = ImageModel
        fields = "__all__"


class AdmDivCodeSerializer(serializers.ModelSerializer):
    class Meta:
        model = AdmDivCodeModel
        fields = "__all__"


class DataBaseSerializer(serializers.ModelSerializer):
    class Meta:
        model = DataBaseModel
        fields = "__all__"

#
#
# class HoursSerializer(serializers.ModelSerializer):
#     class Meta:
#         model = Hours
#         fields = "__all__"
#
#     def to_representation(self, instance):
#         representation = super().to_representation(instance)
#         representation["curse_name"] = instance.course.name
#         representation["teacher_name"] = instance.teacher.nick_name
#         return representation
